package com.tianji.promotion.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tianji.promotion.domain.po.CouponScope;
import com.tianji.promotion.mapper.CouponScopeMapper;
import com.tianji.promotion.service.ICouponScopeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 优惠券作用范围信息 服务实现类
 * </p>
 *
 * @author niu
 */
@Service
public class CouponScopeServiceImpl extends ServiceImpl<CouponScopeMapper, CouponScope> implements ICouponScopeService {


    @Override
    public void deleteByCouponId(Long couponId) {
        LambdaQueryWrapper<CouponScope> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CouponScope::getCouponId, couponId);
        this.remove(wrapper);
    }

    @Override
    public List<CouponScope> getByCouponId(Long couponId) {
        LambdaQueryWrapper<CouponScope> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(CouponScope::getCouponId, couponId);
        return this.list(wrapper);
    }

}
